/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package meteocal.entity;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;

/**
 *
 * @author andrea
 */
@Entity
@DiscriminatorValue(value = "I")
public class InviteNotification extends Notification {
    
    @NotNull
    @ManyToOne
    @JoinColumn(referencedColumnName = "email")
    private Users organizer;
    
    /*
        Getters and Setters
    */
    public Users getOrganizer() {
        return organizer;
    }

    public void setOrganizer(Users organizer) {
        this.organizer = organizer;
    }  
    
    @Override
    public String toString(){
        return String.format("%s %s invited you to %s",
                organizer.getName(),
                organizer.getSurname(),
                event.getTitle());
    }
}
